Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

139
Views
js code with type="module" is doesn't work in my vr environment

I work in a vr environement codding with A-FRAME, I use https://github.com/supermedium/superframe/tree/master/components/log/ to prints logs in vr environement.

<head>
  <title>My A-Frame Scene</title>
  <script src="https://aframe.io/releases/0.9.0/aframe.min.js"></script>
  <script src="https://unpkg.com/aframe-log-component/dist/aframe-log-component.min.js"></script>
  <script type="module" src="./f1.js"></script>
  <script type="module" src="./f2.js"></script>
</head>

<body>
  <a-scene id='main_scene'>
    <a-entity log="channel:c1" geometry="primitive: plane" material="color: #111" text="color: lightgreen" position="0 0 -4"></a-entity>
  </a-scene>
</body>

And in my js I have this:

//f1.js
import foo from 'f2.js'

function f(ts){
  //...
  $('#main_scene').append('<a-entity obj'+ts.name+'></a-entity>');
  AFRAME.registerComponent(
      'obj'+ts.name,
      {
          init:function(){
              var el = this.el;
              el.setAttribute("geometry","primitive:box;depth:"+0.01+";height:"+0.06+";width:"+0.04);
              el.setAttribute('color',"#027523");
              el.setAttribute('position',{x:ts.x,y:ts.y,z:ts.z});
              el.setAttribute('rotation',{x:0,y:ts.orientation,z:0});
          },
          tick: function(){
              foo();
          },
      }
  );
  //...
}
//f2.js
function foo(){
  AFRAME.log("hello",'c1')
}
export default foo

In firefox browsers if i don't use vr It works, but with vr glasses doesn't work. In vr, the object is not created. When I don't use type="module" and I'm codding in a single script, it's works (the problem is not with the logs but with the objects that are not "created")

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!